﻿<%@ Page Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<OAonline.Models.FormModel>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
    <link href="../../Scripts/calendar/css/ui-lightness/jquery-ui-1.8.16.custom.css"
        rel="stylesheet" type="text/css" />

    <script src="../../Scripts/calendar/js/jquery-1.6.2.min.js" type="text/javascript"></script>

    <script src="../../Scripts/calendar/js/jquery-ui-1.8.16.custom.min.js" type="text/javascript"></script>

    <script type="text/javascript">
        //显示表单
        function showInfo(msg) {
            $("#result").html(msg);
        }
        window.onload = function() {
            var inntext = "<%=Model.formdefi %>";
            //  alert(inntext);
            document.getElementById("result").innerHTML = inntext;
        }

        //datepicker
        var comTag;
        $(function() {
            $('#datepicker').datepicker({
                inline: true
            });
        });

        function getTime(tag) {
            comTag = $(tag);
            var offSet = $(comTag).offset();
            $("#datepicker").css("display", "block");
            $("#datepicker").offset({ "top": offSet.top, "left": offSet.left });
        }

        function donote(tag) {
            var dateValue = $(tag).attr("dateParam");
            $(comTag).val(dateValue);
            $("#datepicker").css("display", "none");
        }

        function getTable(btnTag) {
            var hidValue;
            var txtValue = "";
            var txtValForData = "";
            var complete = true;
                        
            var tableTag = $(btnTag).parent();
            var childTag = $(tableTag).children();

            childTag.each(function() {
                var cls = $(this).attr("class");
                if (cls == "txtTable") {
                    var txt = $(this).val();
                    var name = $(this).attr("name");
                    if (txt == "")
                        complete = false;
                    txtValue += txt + ";";
                    txtValForData += name + "-" + txt + ";";
                }
                else if (cls == "hidTable")
                    hidValue = $(this).val();
            });
            
            if (!complete) {
                alert("必须填写完整条件");
                return;
            }

            $("#sqlargs").val(txtValue);

            $.ajax({
                type: "POST",
                url: "/Form/QueryTable",
                data: { "txtValue": txtValue, "sqlValue": hidValue },
                success: function(data) {
                    if (data == "none") {
                        alert("无所需查询结果");
                    } else {
                        alert(data);
                        $("#updateTable").html(data);
                    }
                }
            });
        }
    </script>

</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <div>
        <center>
            <input type="hidden" id="sqlargs" />
            <div id="datepicker" style="display: none; position: absolute; z-index: 102;">
            </div>
            <div id="div_main" style="position: relative; width: 80%; height: 500px; border: solid 1px;
                overflow: auto">
                <span id="result"></span>
            </div>
        </center>
    </div>
</asp:Content>
